package com.cloud.poetry.system.controller;

import com.cloud.poetry.system.entity.dto.LoginDTO;
import com.cloud.poetry.system.entity.dto.RegisterDTO;
import com.cloud.poetry.system.service.LoginService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author mengxj
 */
@RestController
@RequestMapping("login")
public class LoginController {

    @Resource
    private LoginService loginService;

    @PostMapping("login")
    public void login(@RequestBody LoginDTO login){
        this.loginService.login(login);
    }

    @PostMapping("register")
    public void register(@RequestBody RegisterDTO register){
        this.loginService.register(register);
    }
}
